﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyLibary.DAL;

namespace MyLibary.BIZ
{
    public class BIZ_LoaiSanPham
    {
        #region Field
        public string MaLoai { get; set; }
        public string TenLoai { get; set; }
        #endregion
        #region Methold
        public BIZ_LoaiSanPham(string MaLoai, string TenLoai)
        {
            this.MaLoai = MaLoai;
            this.TenLoai = TenLoai;
        }
        public static List<BIZ_LoaiSanPham> getLoaiSanPhams()
        {
            return DAL.DAL_LoaiSanPham.GetLoaiSanPhams();
        }
        public static BIZ_LoaiSanPham getLoaiSanPham(string MaLoai)
        {
            return DAL_LoaiSanPham.GetLoaiSanPham(MaLoai);
        }
        public bool Add()
        {
            return DAL_LoaiSanPham.Insert(this);
        }
        public bool Update()
        {
            return DAL_LoaiSanPham.Update(this);
        }
        public bool Delete()
        {
            return DAL_LoaiSanPham.Delete(this);
        }
        #endregion
    }
    class LoaiSanPhamCompare : IEqualityComparer<BIZ_LoaiSanPham>
    {
        #region IEqualityComparer<BIZ_LoaiSanPham>
        public bool Equals(BIZ_LoaiSanPham x,BIZ_LoaiSanPham y){return x.MaLoai==y.MaLoai;}
        public int GetHashCode(BIZ_LoaiSanPham LoaiSanPham) { return LoaiSanPham.GetHashCode(); }

        #endregion
    }
}
